{include file="header.htm" /}
<body class="bodystyle" style="overflow-y: scroll; cursor: default; -moz-user-select: inherit;">
<div id="toolTipLayer" style="position: absolute; z-index: 9999; display: none; visibility: visible; left: 95px; top: 573px;"></div>
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page min-hg-c-10">
    {include file="bar.htm" /}
    <form class="form-horizontal" id="post_form" action="{:weapp_url('PointsShop/PointsShop/conf')}" method="post">
        <div id="explanation" class="explanation" style="color: rgb(44, 188, 163); background-color: rgb(237, 251, 248); width: 99%; height: 100%;">
            <div id="checkZoom" class="title"><i class="fa fa-lightbulb-o"></i>
                <h4 title="提示相关设置操作时应注意的要点">提示</h4>
                <span title="收起提示" id="explanationZoom" style="display: block;"></span>
            </div>
            <ul>
                <li>积分商城商品不参与会员折扣、分销、积分抵扣，支持商品余额抵扣；积分商城订单不支持叠加营销的优惠券</li>
            </ul>
        </div>
        <div class="ncap-form-default">
            <dl class="row">
                <dt class="tit"><label>积分商城</label></dt>
                <dd class="opt">
                    <label class="curpoin">
                        <input name="openPoints" value="1" type="radio" {if condition="1 === intval($data.openPoints)"} checked="checked" {/if}>开启
                    </label>
                    &nbsp;
                    <label class="curpoin">
                        <input name="openPoints" value="0" type="radio" {if condition="0 === intval($data.openPoints)"} checked="checked" {/if}>关闭
                    </label>
                </dd>
            </dl>

            <dl class="row">
                <dt class="tit"><label>售后维权</label></dt>
                <dd class="opt">
                    <label class="curpoin">
                        <input name="afterSale" value="1" type="radio" {if condition="1 === intval($data.afterSale)"} checked="checked" {/if}>读取系统设置
                    </label>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <label class="curpoin">
                        <input name="afterSale" value="2" type="radio" {if condition="2 === intval($data.afterSale)"} checked="checked" {/if}>自定义售后规则
                    </label>
                    <dl class="row mt10" id="afterSale_2" {if condition="2 === intval($data.afterSale)"} style="background: #f4f4f4;" {else/} style="background: #f4f4f4; display: none;" {/if}>
                        <dt class="tit"><label>已完成订单</label></dt>
                        <dd class="opt">
                            <label class="curpoin">
                                <input name="afterSaleRule" value="1" type="radio" {if condition="1 === intval($data.afterSaleRule)"} checked="checked" {/if}>不允许售后
                            </label>
                            <br>
                            <label class="curpoin">
                                <input name="afterSaleRule" value="2" type="radio" {if condition="2 === intval($data.afterSaleRule)"} checked="checked" {/if}>订单完成后
                                &nbsp;<input type="text" name="afterSaleRuleDays" id="afterSaleRuleDays" value="{$data.afterSaleRuleDays}" class="input-txt tc" style="width: 60px !important;">天&nbsp;内可发起售后维权
                            </label>
                            <p class="notic2">售后维权时间必须在订单完成1～30天之间</p>
                        </dd>
                    </dl>
                </dd>
            </dl>

            <div class="bot mt20">
                <a href="JavaScript:void(0);" onclick="checkForm();" class="ncap-btn-big ncap-btn-green">保存</a>
            </div>
        </div>
    </form>
</div>
<script type="text/javascript">
    $(function() {
        $('input[name=afterSale]').click(function() {
            var value = $(this).val();
            if (1 === parseInt(value)) {
                $('#afterSale_2').hide();
            } else {
                $('#afterSale_2').show();
            }
        });

        $('input[name=afterSaleRule]').click(function() {
            var value = $(this).val();
            if (2 === parseInt(value)) $('#afterSaleRuleDays').focus();
        });
    });

    // 判断输入框是否为空
    function checkForm() {
        layer_loading('正在处理');
        $.ajax({
            url : "{:weapp_url('PointsShop/PointsShop/config')}",
            data: $('#post_form').serialize(),
            type: 'post',
            dataType: 'json',
            success: function(res) {
                layer.closeAll();
                if (1 == res.code) {
                    layer.msg(res.msg, {time: 1500}, function() {
                        window.location.reload();
                    });
                } else {
                    layer.alert(res.msg, {icon: 0});
                }
            }
        });
    }
</script>
{include file="footer.htm" /}